home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Inne / Gry / Carnage_Contest / scripts / CC Original / movement / End Turn.lua < prev    next >
Text File  |  2009-09-14  |  2KB  |  50 lines

  1. --------------------------------------------------------------------------------
  2. -- Weapon End Turn
  3. -- Original Carnage Contest Weapon
  4. -- Script by DC, September 2009, www.UnrealSoftware.de
  5. --------------------------------------------------------------------------------
  6.  
  7. -- Setup Tables
  8. if cc==nil then cc={} end
  9. cc.endturn={}
  10.  
  11. -- Load & Prepare Ressources
  12. cc.endturn.gfx_wpn=loadgfx("weapons/endturn.png")                        -- Weapon Image
  13. setmidhandle(cc.endturn.gfx_wpn)
  14. cc.endturn.sfx_attack=loadsfx("boing.ogg")
  15.  
  16.  
  17. --------------------------------------------------------------------------------
  18. -- Weapon: End Turn
  19. --------------------------------------------------------------------------------
  20.  
  21. cc.endturn.id=addweapon("cc.endturn","End Turn",cc.endturn.gfx_wpn)        -- Add Weapon
  22.  
  23. function cc.endturn.draw()                                                -- Draw
  24.     if (weapon_shots<=0) then
  25.         setblend(blend_alpha)
  26.         setalpha(1)
  27.         setcolor(255,255,255)
  28.         setscale(0.5+math.abs(math.sin(math.rad(weapon_charge)))*0.5,0.5+math.cos(math.sin(math.rad(weapon_charge)))*0.5)
  29.         drawimage(cc.endturn.gfx_wpn,getplayerx(0),getplayery(0)-30)
  30.         -- Animation
  31.         weapon_charge=weapon_charge+5
  32.         if weapon_charge>=360 then weapon_charge=0 end
  33.         -- HUD Info
  34.         hudinfo("Press [Space] to end the turn!")
  35.     end
  36. end
  37.  
  38. function cc.endturn.attack(attack)                                        -- Attack
  39.     if (weapon_shots<=0) then
  40.         if (attack==1) then
  41.             -- No more weapon switching!
  42.             useweapon(0)
  43.             weapon_shots=weapon_shots+1
  44.             -- SFX
  45.             playsound(cc.endturn.sfx_attack)
  46.             -- End Turn
  47.             endturn()
  48.         end
  49.     end
  50. end